//----------------------------------Include-------------------------------------
#include <stdint.h>
#include <stdio.h>

#include "mcu.h"
#include "brd.h"
#include "glbvar.h"
#include "calc.h"
//------------------------------------------------------------------------------

//-----------------------------------Macro--------------------------------------
#define _tx_data(p, l)        do{ mcu_uart0_dma_tx((char*)p, l); }while(0)
//------------------------------------------------------------------------------

//---------------------------------Static Var-----------------------------------
static uint64_t    nu64_time_tick = 0;
//------------------------------------------------------------------------------
static ATTR_PLACE_AT_NONCACHEABLE  char   ntxbuf[64];
//------------------------------------------------------------------------------

//--------------------------------Static Func-----------------------------------
//------------------------------------------------------------------------------

//---------------------------------Public Func----------------------------------
int main(void)
{
  calc_init();
  brd_init();
  _tx_data("start!\r\n", 8);

  //mcu_init_wdg0();
  while(1){
    //mcu_wdg0_feed();
    if(igu32_bufflag){
      igu32_bufflag = 0;
      calc_para();
    }

    if(igu64_tick_ms > nu64_time_tick + 1000){
      nu64_time_tick = igu64_tick_ms;
      mcu_led_toggle();
      snprintf(ntxbuf, 10, "%0.3f\r\n", gf_delta_f);
      _tx_data(ntxbuf, strlen(ntxbuf));
    }

  }
}
//-----------------------------------EOF----------------------------------------



